<template>
	<view class="role-selection">
	  <view class="role-option">
		<button @click="chooseRole('companions')" class="role-btn">陪诊师</button>
	  </view>
	  <view class="role-option">
		<button @click="chooseRole('patient')" class="role-btn">患者</button>
	  </view>
	</view>
</template>

<script setup>
import { ref } from 'vue';

const role = ref('');  // 存储选择的角色

// 选择角色
const chooseRole = (selectedRole) => {
  role.value = selectedRole;
  // 跳转到不同的页面或进行后续操作
  setTimeout(() => {
    // 假设根据角色跳转到不同页面
    if (role.value === 'companions') {
      uni.redirectTo({
        url: `/pages/register/companion/index?roleKey=${role.value}`,  // 陪诊师的主页
      });
    } else if (role.value === 'patient') {
      uni.redirectTo({
        url: `/pages/register/index?roleKey=${role.value}`
      });
    }
  }, 2000);
};
</script>

<style>
	@import url(./index.css);
</style>
